package com.hctg.forced2sleep.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;

import com.actor.myandroidframework.utils.ConfigUtils;
import com.hctg.forced2sleep.activity.AlarmClockActivity;
import com.hctg.forced2sleep.activity.LockUnLockScreenActivity;
import com.hctg.forced2sleep.activity.MonitorSettingActivity;
import com.hctg.forced2sleep.activity.TestActivity;
import com.hctg.forced2sleep.activity.TutorialActivity;
import com.hctg.forced2sleep.databinding.FragmentHomeBinding;
import com.hctg.forced2sleep.dialog.PermissionListDialog;
import com.hctg.forced2sleep.dialog.SleepTimeSetDialog;

/**
 * description: 描述
 * company    :
 * @author    : ldf
 * date       : 2024/6/3 on 21:33
 */
public class HomeFragment extends BaseFragment<FragmentHomeBinding> {

    public HomeFragment() {
        // Required empty public constructor
    }

    public static HomeFragment newInstance() {
        return new HomeFragment();
    }

    @Override
    public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        //新人教程
        viewBinding.itemVideo.setOnClickListener(view1 -> {
            startActivity(new Intent(mActivity, TutorialActivity.class));
        });
        //权限
        viewBinding.btnPermission.setOnClickListener(view1 -> {
            new PermissionListDialog().show(getChildFragmentManager());
        });
        //监督
        viewBinding.btnMonitor.setOnClickListener(view1 -> {
            MonitorSettingActivity.start(mActivity);
        });
        //定时
        viewBinding.btnAlarm.setOnClickListener(view1 -> {
            AlarmClockActivity.start(mActivity);
        });
        viewBinding.animationView.setOnClickListener(view1 -> {
            if (ConfigUtils.IS_APP_DEBUG) {
                TestActivity.start(mActivity);
            }
        });
        //禅定时长设置
        viewBinding.tvTime.setOnClickListener(view1 -> {
            new SleepTimeSetDialog(mActivity, minute -> {
                viewBinding.tvTime.setText(String.format("%02d分钟", minute));
            }).show();
        });
        //开始
        viewBinding.btnStart.setOnClickListener(view1 -> {

        });
    }
}